package com.dog.basics.admin.controller.mtkj;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.dog.basics.bean.dto.admin.mtkj.GoodsEvaluateFromDto;
import com.dog.basics.bean.vo.admin.mtkj.GoodsEvaluateVo;
import com.dog.basics.common.annotation.SysLog;
import com.dog.basics.common.util.PageParam;
import com.dog.basics.common.util.R;
import com.dog.basics.service.mtkj.IMtGoodsEvaluateService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 商品评价表 前端控制器
 * </p>
 *
 * @author wph
 * @since 2020-11-09
 */
@RestController
@RequestMapping("/pc/goods/evaluate")
@Api(value = "商品评价模块", tags = "商品评价模块")
@AllArgsConstructor
public class MtGoodsEvaluateController {
    private final IMtGoodsEvaluateService mtGoodsEvaluateService;
    /**
     * @Description: 分页商品评价列表
     * @Param:GoodsEvaluateFromDto
     * @return: IPage<GoodsEvaluateVo>
     * @Author: wph
     * @Date:
     */
    @ApiOperation(value = "分页商品评价列表", notes = "pc:goodsEvaluate:page")
    @GetMapping
    @PreAuthorize("@pms.hasPermission('pc:goodsEvaluate:page')")
    public R<IPage<GoodsEvaluateVo>> page(PageParam page, GoodsEvaluateFromDto obj) {
        IPage<GoodsEvaluateVo> advicePageDto = mtGoodsEvaluateService.getPageList(page, obj);
        return R.ok(advicePageDto);
    }
    /**
     * @Description: 删除商品评价
     * @Param: ids
     * @return: Boolean
     * @Author: wph
     * @Date: 2020/05/29  0027
     */
    @SysLog("删除商品评价")
    @ApiOperation(value = "删除商品评价", notes = "pc:goodsEvaluate:delete")
    @ApiImplicitParam(name = "ids", value = "标识Ids", dataType = "List<Long>", required = true)
    @DeleteMapping
    @PreAuthorize("@pms.hasPermission('pc:goodsEvaluate:delete')")
    public R<Boolean> delete(@RequestBody List<Long> ids) {
        return R.ok(mtGoodsEvaluateService.deleteObjs(ids));
    }
}
